import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

// ignore: constant_identifier_names
const DEFAULT_TOAST_COLOR = Color(0xFF424242);

class ToastUtils {
  ToastUtils._internal();

  static void toast(String msg, {Color color = DEFAULT_TOAST_COLOR, Toast toastLength = Toast.LENGTH_SHORT}) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      backgroundColor: color,
      textColor: Colors.white,
      fontSize: 16.0,
    );
  }

  static void warning(String msg, {Toast toastLength = Toast.LENGTH_SHORT}) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      backgroundColor: Colors.yellow,
      textColor: Colors.black,
      fontSize: 16.0,
    );
  }

  static void error(String msg, {Toast toastLength = Toast.LENGTH_SHORT}) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      backgroundColor: Colors.red,
      textColor: Colors.white,
      fontSize: 16.0,
    );
  }

  static void success(String msg, {Toast toastLength = Toast.LENGTH_SHORT}) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      backgroundColor: Colors.lightGreen,
      textColor: Colors.white,
      fontSize: 16.0,
    );
  }
}
